﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Model;
using System.Web;
using System.IO;

namespace ECRM.Module.Web
{
    [PropertyEditor(typeof(string), false)]
    public class ASPxHtmlPropertyEditorNew : DevExpress.ExpressApp.HtmlPropertyEditor.Web.ASPxHtmlPropertyEditor
    {
        public ASPxHtmlPropertyEditorNew(Type objectType, IModelMemberViewItem info)
            : base(objectType, info)
        {

        }
        protected override void SetupControl(System.Web.UI.WebControls.WebControl control)
        {
            base.SetupControl(control);
            if (ViewEditMode == ViewEditMode.Edit)
            {
                string _uploadFolder = "~/UploadFolder/";
                string _directoryString = HttpContext.Current.Server.MapPath(_uploadFolder);
                if (!Directory.Exists(_directoryString))
                {
                    Directory.CreateDirectory(_directoryString);
                }
                Editor.SettingsImageUpload.UploadImageFolder = _uploadFolder;
            }
        }
    }
}
